doHUDMessages()
{
		wait 1;

		self iprintlnbold("double-click^5 [{+melee}] ^7: to save position");
wait 3;
		self iprintlnbold("double-click^1 [{+activate}] ^7: to load saved position");
}

_MeleeKey()
{
	self endon("end_saveposition_threads");

	for(;;)
	{
		if(self meleeButtonPressed())
		{
			catch_next = false;

			for(i=0; i<=0.10; i+=0.01)
			{
				if(catch_next && self meleeButtonPressed())
				{
					self thread savePos();
					wait 1;
					break;
				}
				else if(!(self meleeButtonPressed()))
					catch_next = true;

				wait 0.01;
			}
		}

		wait 0.05;
	}

}

_UseKey()
{
	self endon("end_saveposition_threads");

	for(;;)
	{
		if(self useButtonPressed())
		{
			catch_next = false;

			for(i=0; i<=0.10; i+=0.01)
			{
				if(catch_next && self useButtonPressed())
				{
					self thread loadPos();
					wait 1;
					break;
				}
				else if(!(self useButtonPressed()))
					catch_next = true;

				wait 0.01;
			}
		}

		wait 0.05;
	}
}

loadPos()
{
	if(!isDefined(self.saved_origin))
		{
		self iprintlnbold("^1T^7here is no previous position to load.");
		return;
		}
	else
		{
		self setPlayerAngles(self.saved_angles); // angles need to come first
		self setOrigin(self.saved_origin);
		self iprintln("^2P^7revious position loaded.");
		}

}


savePos()
{
	self.saved_origin = self.origin;
	self.saved_angles = self.angles;
	self iprintln("^2P^7osition saved.");
}

showlogo()
{

logotext = &"^4(^5Spm^4) ^2Save position mod ^3V1.0";

		if(isdefined(level.logo))
			level.logo destroy();

		level.logo = newHudElem();	
		level.logo.x = 631;
		level.logo.y = 475;
		level.logo.alignX = "right";
		level.logo.alignY = "middle";
		level.logo.sort = -3;
		level.logo.alpha = 1;
		level.logo.fontScale = 0.6;
		level.logo.archived = true;
		level.logo setText(logotext);
}